package springboot_rabbitmq.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author 帅小伙
 * @date 2022/1/7
 * @description
 */

@Component
@Slf4j
public class WarningCustomer {


    public static final String WARNING_QUEUE_NAME = "warning.queue";
    @RabbitListener(queues = WARNING_QUEUE_NAME)
    public void receiveD(Message message){
        String msg = new String(message.getBody());
        log.info("当前时间{},收到报警队列{}的消息:{}",new Date(),WARNING_QUEUE_NAME,msg);
    }
}
